package com.oo.viewlib.fragments


import android.os.Bundle
import android.support.v4.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.SeekBar
import com.oo.chartlibrary.charts.RadarChartView

import com.oo.viewlib.R


/**
 * A simple [Fragment] subclass.
 */
class RadarChartFragment : Fragment() {


    override fun onCreateView(inflater: LayoutInflater?, container: ViewGroup?,
                              savedInstanceState: Bundle?): View? {
        // Inflate the layout for this fragment
        val root=inflater!!.inflate(R.layout.fragment_radar_chart, container, false)
        val seekBar=root.findViewById<SeekBar>(R.id.seekbar)
        val chart=root.findViewById<RadarChartView>(R.id.radar_chart)
        seekBar.max=360
        seekBar.setOnSeekBarChangeListener(object :SeekBar.OnSeekBarChangeListener{
            override fun onProgressChanged(seekBar: SeekBar?, progress: Int, fromUser: Boolean) {
                chart.setStartAngle(progress)
            }

            override fun onStartTrackingTouch(seekBar: SeekBar?) {
            }

            override fun onStopTrackingTouch(seekBar: SeekBar?) {
            }
        })

        return root
    }

}// Required empty public constructor
